from typing import Annotated, Optional

from pydantic import Field

from owl_common.base.model import AuditEntity


class KnowledgeBaseEntity(AuditEntity):
    """
    知识库
    """

    # 知识库id
    id: Annotated[Optional[int], Field(default=None)]

    # 知识库名称
    name: Annotated[Optional[str], Field(default=None)]

    # 知识库描述
    description: Annotated[Optional[str], Field(default=None)]

    # 知识库类型
    type: Annotated[Optional[str], Field(default=None)]

    """
    向量库配置
    {
        ”type“: "milvus",
        "config": {
            "host": "localhost",
            "port": 19530,
            "user": "root",
            "password": "Milvus@2023",
            "collection_name": "knowledge_base"
        }
    }
    """
    vector_store: Annotated[Optional[dict], Field(default=None)]

    # 分片策略配置
    chunk_strategy: Annotated[Optional[dict], Field(default=None)]

    # 向量化策略
    embedding_strategy: Annotated[Optional[dict], Field(default=None)]

    # 知识库状态
    status: Annotated[Optional[str], Field(default=None)]


class KnowledgeFileEntity(AuditEntity):
    """
    知识库文件
    """
    # 知识库文件id
    id: Annotated[Optional[int], Field(default=None)]
    # 知识库id
    kid: Annotated[Optional[int], Field(default=None)]
    # 文件名
    file_name: Annotated[Optional[str], Field(default=None)]
    # 文件磁盘名
    disk_name: Annotated[Optional[str], Field(default=None)]
    # 文件类型
    file_type: Annotated[Optional[str], Field(default=None)]
